// 封装首页所有的api
import request from '@/utils/request'
import type {HospitalResponseData,HospitalLevelResponseData,HospitalSearch} from "@/api/home/type";

// 通过枚举管理首页的接口地址
enum API {
  // 获取医院数据展示到卡片
  HOSPITAL_URL = '/hosp/hospital/',
  // 获取医院的等级和地区
  HOSPITAL_DICT_URL = '/cmn/dict/findByDictCode/',
  // 根据关键字名字获取医院
  HOSPITAL_SEARCH_URL = '/hosp/hospital/findByHosname/',
}

// 获取医院详情数据
export const reqHospital=(page: number,limit: number,hostype='',districtCode='') =>
  request.get<any,HospitalResponseData>(
      API.HOSPITAL_URL + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`
  )

// 获取医院的等级和地区
export const reqHospitalDict=(dictCode: string) =>
  request.get<any,HospitalLevelResponseData>(API.HOSPITAL_DICT_URL + dictCode)

// 根据关键字名字获取医院
export const reqHospitalSearch= (hosname: string) =>
  request.get<any,HospitalSearch>(API.HOSPITAL_SEARCH_URL + hosname)